<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>会员选择</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<jsp:include page="/page/head.jsp"></jsp:include>
	<script type="text/javascript">
		
		$(document).ready(function(){
			
		    $('#mgrTable').datagrid({
	       		height: 350, 
		        pageSize: 20,//每页显示的记录条数，默认为10  
		        pageList: [10,15,20],//可以设置每页记录条数的列表
				nowrap: true,
	        	border: true,  
				striped: true,
				collapsible: false,
				url:path+'/user/list.do?isMaster=1',
				sortName: 'id',
				sortOrder: 'asc',
				remoteSort: false,
				singleSelect:true,
				idField:'id',
				columns:[[
	                {field:'ck',checkbox:true},
					{field:'truename',title:'名称',width:170},
					{field:'card',title:'卡号',width:170},
					{field:'mobile',title:'手机',width:170}
				]],
				pagination:true,
				rownumbers:true
			});
			var p = $('#mgrTable').datagrid('getPager');
			$(p).pagination({   
		        beforePageText: '第',//页数文本框前显示的汉字  
		        afterPageText: '页    共  {pages} 页',  
		        displayMsg: '当前显示  {from} - {to} 条记录   共  {total} 条记录'
		    });
			
		});	
		
		function save(){
			var selected = $('#mgrTable').datagrid('getSelected');
			if(selected){
				var ret = new Array();
				ret[0] = selected.id;
				ret[1] = selected.truename;
				window.returnValue = ret;
				window.close();
			}else{
				alertBox("请选择！");
			}
			
			
		}
		
		function callback(){
			window.close();
		}
		
		function search(){
			var name = $('#name').val();
			var card = $('#card').val();
			$('#mgrTable').datagrid('reload',{name:name,card:card});
		}
		
		function clean(){
			$('#name').attr('value','');
			$('#card').attr('value','');
		}
	</script>
  </head>
  
  <body>
  <div class="right">
	<form id="fm">
	<div class="ri_main">
		<table width="600" border="0" cellspacing="1" cellpadding="8" style="background:#d9d9d9;">
		  
		  <tr>
		    <td align="left" bgcolor="#FFFFFF">
				<table width="90%" border="0" cellspacing="0" cellpadding="4">
				  <tr>
				    <td style="vertical-align: middle;">
				    	<label>名称：</label> 
				    	<input class="easyui-validatebox" type="text" name="name" id="name" /> 
				    	<label>卡号：</label>
						<input class="easyui-validatebox" type="text" name="card" id="card" /> 
						<input type="button" onclick="search()" value="查询" />
						<input type="button" onclick="clean()" value="清除" />
				    </td>
				  </tr>
				</table>
				
			 	<table id="mgrTable">
			 		
			 	</table>  
			</td>
		  </tr>
		   
		   <tr>
		    <td align="center" bgcolor="#FFFFFF">
				<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">确定</a>
				<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-undo" onclick="callback()">取消</a>
			</td>
		   </tr>
		</table>
	</div>
	</form>
	</div>
  </body>
</html>